# name : proc lifetest for stratified logrank stat, full template
# key : lifetest.logrank.stat.stratified.full
# contributor: Shuguang Sun
# --
ods select quartiles means homstats homtests survdiff logunichisq survivalplot censoredsummary;
ods output lifetest.stratum1.productlimitestimates = $5_prodest1;
ods output lifetest.stratum2.productlimitestimates = $5_prodest2;
ods output homtests=${5:km}_testp;
ods output HomStats=$5_stat LogrankHomCov=$5_cov;
ods output quartiles = $5_quart;
proc lifetest data = ${1:dtin}
method = km alpha = 0.05 alphaqt = 0.05 conftype = linear
timelist = 12 reduceout outsurv=os
plots = survival(atrisk=0,8,12 test);
time ${2:aval} * ${3:cnsr} (1);
strata $0 / group=${4:trt01pn} test=(logrank wilcoxon lr) diff=control("2") adjust=bon;
run;

data _${5:km}_stats;
* need to filter loc of matrix by trt;
merge ${5:km}_testp $5_stat(keep=LogRank) $5_cov(keep=cov);
rawz=logrank/sqrt(cov);
run;